//
//  DoctorCell.m
//  DrProcessTable
//
//  Created by 白岩凇 on 2016/10/4.
//  Copyright © 2016年 白岩凇. All rights reserved.
//

#import "DoctorCell.h"

@interface DoctorCell ()
@property (weak, nonatomic) IBOutlet UIImageView *DoctorImage;
@property (weak, nonatomic) IBOutlet UILabel *DoctorName;
@property (weak, nonatomic) IBOutlet UILabel *DoctorStatus;
@property (weak, nonatomic) IBOutlet UILabel *DoctorGoodAt;
@property (weak, nonatomic) IBOutlet UILabel *mainDoctor;
//可预约
@property (weak, nonatomic) IBOutlet UILabel *can;

@end

@implementation DoctorCell

+ (instancetype)cellWithTableView:(UITableView*)tableView{
    static NSString* ID=@"Dkt_ID";
    DoctorCell* cell=[tableView dequeueReusableCellWithIdentifier:ID];
    if (cell==nil) {
        cell=[[[NSBundle mainBundle]loadNibNamed:NSStringFromClass(self) owner:nil options:nil]lastObject];
    }
    return cell;
    
}

- (void)setModel:(DktCellModel *)model{
    _model=model;
    if (self.can.hidden==YES) {
        self.can.hidden=NO;
    }
    self.DoctorImage.image=[UIImage imageNamed:model.DoctorImage];
    self.DoctorName.text=model.DoctorName;
    self.DoctorStatus.text=[NSString stringWithFormat:@"%d",(int)model.DoctorStatus];
    if (model.DoctorPeople==0) {
        self.can.hidden=YES;
        self.DoctorStatus.text=@"不可预约";
    }else{
        self.DoctorStatus.text= [NSString stringWithFormat:@"%d",(int)model.DoctorPeople];
    }
    self.mainDoctor.text=model.mainDoctor;
    self.mainDoctor.text = [NSString stringWithFormat:@"%@:%@",model.mainDoctor,model.HospitalName];
    self.DoctorGoodAt.text=model.DoctorGoodAT;
    [self layoutIfNeeded];
    CGFloat need=CGRectGetMaxY(self.DoctorGoodAt.frame);
    model.h=need+10;
    
}

- (void)awakeFromNib {
    self.DoctorGoodAt.preferredMaxLayoutWidth=[UIScreen mainScreen].bounds.size.width-16;//为了保证计算出来的数值和显示出来的一致
}



@end
